// 1. 从redux包里面引入一个方法 createStore()
import { applyMiddleware, createStore, combineReducers } from 'redux'
// 引入配合中间件使用redux调试工具的包
import { composeWithDevTools } from 'redux-devtools-extension'
// 引入redux-thunk
import thunk from 'redux-thunk'
// 引入reducer
import zsReducer from './reducer'
import lsReducer from './List/reducer'

// 合并reducer
// rootReducer就是合并之后的reducdr
const rootReducer = combineReducers({
  zs: zsReducer,
  ls: lsReducer,
})
// 2. 创建store对象
const store = createStore(
  rootReducer,
  composeWithDevTools(applyMiddleware(thunk))
)
// dispatch -->中间件1 --> 中间件2 --> 中间件3--> reducer
// const store = createStore(reducer, applyMiddleware(中间件1,中间件2,中间件3))

export default store
